package org.graduates.webapp.actions.course.json;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.graduates.webapp.actions.BaseAction;
import org.projects.graduates.domain.HomeworkComment;
import org.projects.graduates.page.Pager;

@Action(results = { @Result(name = "success", type = "json"), @Result(name = "input", type = "json") })
public class GetHomeworkCommentTotalAction extends BaseAction {

	private static final long serialVersionUID = -8618991119535795119L;

	private boolean success = false;

	private long handid = 0L;

	private long total = 0L;
	
	
	public String execute() {

		if (0L == handid) {
			return SUCCESS;
		}

		Pager pager = pagerOf(HomeworkComment.class, " where o.handin.id=" + handid);
		
		this.total = pager.getRowCount();

		success = true;

		return SUCCESS;
	}

	public boolean isSuccess() {
		return success;
	}

	public void setHandid(long handid) {
		this.handid = handid;
	}

	public long getTotal() {
		return total;
	}

	

}
